﻿using System;
using System.Windows.Forms;

namespace 活字格开发浏览器
{
    public partial class Form1 : Form
    {

        

        public Form1()
        {
            var k_hook = new KeyboardHook();
            k_hook.KeyDownEvent += new KeyEventHandler(hook_KeyDown);//钩住键按下
            k_hook.Start();//安装键盘钩子
            InitializeComponent();
            
        }



        private void button1_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(textBox1.Text);
        }

        private void hook_KeyDown(object sender, KeyEventArgs e)
        {
            //判断按下的键（Alt + A）
            if (e.KeyValue == (int)Keys.S && (int)Control.ModifierKeys == (int)Keys.Control)
            {
                webBrowser1.Refresh();
            }

            if (e.KeyValue == (int)Keys.Enter)
            {
                webBrowser1.Navigate(textBox1.Text);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
